﻿using System;

namespace Sparkle.MVVM.Messages
{
    public class Message :IMessage
    {
        public Action<object, string, object> MessageAction { get; protected set; }

        public Message(object assosiatedObject, Action<object,string ,object> messageAction)
        {
            AssosiatedObject =assosiatedObject;
            MessageAction = messageAction;
        }

        public object AssosiatedObject { get; set; }

        public object Process(object sender, string messageName, object attachedObject)
        {
            if(MessageAction!=null)
            {
                MessageAction(sender, messageName, attachedObject);
            }

            return null;
        }

    }
}